@extends('layouts._app')
@section('content')
    <body>
    <div class="wrap-container">
        @include('layouts._flash')
        {!! Form::open(['route' => 'blog.category.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'post']) !!}
        {!! Form::hidden('static',$request['static']) !!}
        <div class="layui-form-item">
            {!! Form::label('','属于：',['class'=>'layui-form-label']) !!}
            <div class="layui-input-block">
                <select lay-verify="required">
                    <option value="1" @if($request['static'] == '1') selected @endif disabled>文章分类</option>
                    <option value="2" @if($request['static'] == '2') selected @endif disabled>意见反馈分类</option>
                    <option value="3" @if($request['static'] == '3') selected @endif disabled>问题分类</option>
                    <option value="4" @if($request['static'] == '4') selected @endif disabled>图片集锦</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            {!! Form::label('','上级：',['class'=>'layui-form-label']) !!}
            <div class="layui-input-block">
                <select name="parent_id" lay-verify="required">
                    <option value="0">顶级菜单</option>
                    @if($category)
                        @foreach($category as $value)
                            <option @if($value->id == $request->id && !empty($request)) selected @endif
                            value="{{$value->id}}">{{$value->name}}</option>
                            @foreach($value->children as $children)
                                @if($value->id == $children->parent_id)
                                    <option disabled>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├─{{$children->name}}</option>
                                @endif
                            @endforeach
                        @endforeach
                    @endif
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            {!! Form::label('','* 名称：',['class'=>'layui-form-label','style'=>'color:red']) !!}
            <div class="layui-input-block">
                {!! Form::text('name','',['required','lay-verify'=>'required','class'=>'layui-input','placeholder'=>'请输入名称']) !!}
            </div>
        </div>
        <div class="layui-form-item">
            {!! Form::label('','是否显示：',['class'=>'layui-form-label']) !!}
            <div class="layui-input-block">
                <input type="radio" name="is_show" value="1" title="是" checked>
                <input type="radio" name="is_show" value="2" title="否">
            </div>

        </div>
        <div class="layui-form-item">
            {!! Form::label('','* 排序：',['class'=>'layui-form-label','style'=>'color:red']) !!}
            <div class="layui-input-block">
                {!! Form::number('sort_order','',['required','lay-verify'=>'required','class'=>'layui-input','placeholder'=>'请输入排序']) !!}
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'siteInfo','lay-submit']) !!}
                {!! Form::reset('重置',['class'=>'layui-btn layui-btn-primary']) !!}
            </div>
        </div>
        {!! Form::close() !!}
    </div>
    <script src="{{asset('static/admin/layui/layui.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('js/jquery.min.js')}}" type="text/javascript" charset="utf-8"></script>
    <script>
        //Demo
        layui.use(['form', 'jquery'], function () {
            var form = layui.form();
            $ = layui.jquery;
            form.render();
            //监听提交
            form.on('submit(formDemo)', function (data) {
                console.log(data)
            });

        });
    </script>
    </body>
@endsection
